package nuc98x

import (
	"os"
	"syscall"
	_ "unsafe"
)

//TODO madplay 音量控制参考
func SetVolume(v int) error {
	//var iLevel int=50
	// Use the devfs path for now instead of sysfs path.
	f, err := os.OpenFile("/dev/mixer", os.O_WRONLY, 0)
	defer f.Close()

	if err != nil {
		return err
	}
	/*设置混音通道增益*/

	//ioctl(f.Fd(),MIXER_WRITE(SOUND_MIXER_VOLUME), uintptr(unsafe.Pointer(&iLevel)))

	return nil
}

func ioctl(fd, cmd, arg uintptr) error {
	_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, arg)
	if err != 0 {
		return err
	}
	return nil
}
